package com.szbber.commen.utils

import android.content.Context
import com.blankj.utilcode.utils.StringUtils
import com.google.gson.Gson
import com.orhanobut.logger.Logger
import com.szbber.commen.api.Repository
import com.szbber.commen.api.launch
import com.szbber.commen.bean.DeptBean
import kotlinx.coroutines.*

object CommonUtil {

    fun getBaseUrl(): String {
        var service = ""
        runBlocking {
            service = dataStoreRead("serviceIp")
        }
        return if (StringUtils.isEmpty(service)) {
            "http://122.112.148.38:8888"
        } else {
            "http://$service"
        }
    }

    fun getDeptName(): String {
       var deptName = ""
        runBlocking {
            val deptBean = Gson().fromJson<DeptBean.Data>(dataStoreRead<String>("DeptBean"),
                DeptBean.Data::class.java)
           deptName = deptBean.name
        }
        return  deptName
    }


}